<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script>
        window.onload = function(){

            //页面加载完成
            document.getElementById('uid').value = window.localStorage.getItem('uid');
            document.getElementById('password').value = window.localStorage.getItem('ps');
            //登录  存数据
            document.getElementById('btn').onclick = function(){
                var uid = document.getElementById('uid');
                var ps = document.getElementById('password');
                //本地存储
                window.localStorage.setItem('uid',uid.value);
                window.localStorage.setItem('ps',ps.value);
            }
        }

    </script>
</head>
<body>

卡号<input type="text" id="uid"/>
<br/>
密码<input type="text" id="password"/>
<input type="button" value="登录" id="btn"/>

</body>
</html>